<include file='Common:header'/>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            &nbsp;
            <!--后台登陆日志
            <small></small>-->
        </h1>
        <ol class="breadcrumb">
            <li><a href="{:U('Index/index')}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">后台登陆日志</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <!-- START CUSTOM TABS -->
        <div class="row">
            <div class="col-xs-12">
                <!-- Custom Tabs -->
                <div class="nav-tabs-custom">

                    <ul class="nav nav-tabs">

                        <li class="active"><a href="#tab_detail" data-toggle="tab" rel="tab_detail">登陆日志</a></li>

                        <li class="pull-right"></li>
                    </ul>

                    <div class="tab-content">

                        <div class="tab-pane active" id="tab_detail">


                            <div style="width:100%;">
                                <form role="form" method="post">
                                <div class="box">
                                    <div class="box-header with-border">

                                        <div class="search_type cc mb10">
                                            <div class="mb10"> <span class="mr20">
                                                搜索状态：
                                                <select style="width:100px;" name="status" class="select">
                                                    <option value='' <if condition="$_GET['status'] eq ''">selected</if>>不限</option>
                                                    <option value="1" <if condition="$_GET['status'] eq '1'">selected</if>>登陆成功</option>
                                                    <option value="0" <if condition="$_GET['status'] eq '0'">selected</if>>登陆失败</option>
                                                </select>
                                                用户名：<input type="text" class="input length_2" name="username" size='10' value="{$_GET.username}" placeholder="用户名">
                                                IP：<input type="text" class="input length_2" name="loginip" size='20' value="{$_GET.loginip}" placeholder="IP">
                                                时间：
                                                <input type="text" name="start_time" id="start_time" class="input length_2 J_date" value="{$_GET.start_time}" style="width:80px;">
                                                -
                                                <input type="text" name="end_time" id="end_time" class="input length_2 J_date" value="{$_GET.end_time}" style="width:80px;">
                                                <button class="button">搜索</button>
                                                </span>
                                            </div>
                                        </div>


                                    </div><!-- /.box-header -->
                                    <div class="box-body no-padding">

                                        <div class="col-xs-12">
                                            <!-- general form elements -->
                                            <div class="box box-primary">

                                                <div class="box-header">
                                                    <div class="box-left">
                                                        <div style="width: 400px;" class="input-group">
                                                            <div class="columns columns-right btn-group pull-left">
                                                                <button title="删除选中" name="delete" type="button"
                                                                        data-fun="del"
                                                                        class="btn btn-default"><i
                                                                        class="glyphicon glyphicon-trash"></i>
                                                                </button>
                                                                <button title="刷新" name="refresh" type="button"
                                                                        class="btn btn-default"><i
                                                                        class="glyphicon glyphicon-refresh icon-refresh"></i>
                                                                </button>
                                                                <!--
                                                                <button title="展开/折叠" name="toggle" type="button"
                                                                        class="btn btn-default"><i
                                                                        class="glyphicon glyphicon-list-alt icon-list-alt"></i>
                                                                </button>
                                                                <div class="export btn-group">
                                                                    <button type="button" data-toggle="dropdown"
                                                                            class="btn btn-default dropdown-toggle"><i
                                                                            class="glyphicon glyphicon-save"></i>
                                                                        <span class="caret"></span></button>
                                                                    <ul role="menu" class="dropdown-menu">
                                                                        <li data-type="csv"><a
                                                                                href="javascript:void(0)">CSV</a></li>
                                                                        <li data-type="excel"><a
                                                                                href="javascript:void(0)">Excel</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                                -->
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div><!-- /.box-header -->

                                                <table class="table table-condensed table-striped table-bordered table-hover dataTable no-footer">
                                                    <tbody><tr>
                                                        <th class="text-center took-w40">
                                                            <input type="checkbox" name="btSelectAll">
                                                        </th>
                                                        <th style="width: 50px">ID</th>
                                                        <th>用户名</th>
                                                        <th>其他说明</th>
                                                        <th class="took-w120">时间</th>
                                                        <th class="took-w110">IP</th>
                                                        <th class="took-w60 text-center">状态</th>
                                                        <th class="text-center" style="width: 90px">操作</th>
                                                    </tr>

                                                    <volist name="data" id="d">
                                                        <tr>
                                                            <td class="text-center">
                                                                <input type="checkbox" name="ids" value="{$d.id}" class="inverted">
                                                            </td>
                                                            <td>{$d.id}</td>
                                                            <td>{$d.username}</td>
                                                            <td>{$d.info}</td>
                                                            <td>{$d.logintime|date='Y-m-d H:i',###}</td>
                                                            <td>{$d.loginip}</td>
                                                            <td class="res-status text-center" data-url="" data-id="{$d.id}" data-status-ok="登陆成功" data-status-no="登陆失败">
                                                                <if condition="$d[status] eq 1">
                                                                    <span data-toggle="tooltip" title="登陆成功">
                                                                        <i class="icon fa fa-check text-green"></i>
                                                                    </span>
                                                                    <else/>
                                                                    <span data-toggle="tooltip" title="登陆失败">
                                                                        <i class="icon fa fa-close text-red"></i>
                                                                    </span>
                                                                </if>
                                                            </td>
                                                            <td class="text-center">
                                                                <a href="javascript:del({$d.id})" title="删除"><i class="glyphicon glyphicon-trash"></i></a>
                                                            </td>
                                                        </tr>
                                                    </volist>

                                                    </tbody></table>

                                            </div><!-- /.box -->

                                            <div class="took-page">
                                                <button type="button" class="btn btn-primary" onclick="delData()"><i class="glyphicon glyphicon-trash text-purple"></i> 删除一个月前的登陆日志</button>
                                                {$page}
                                            </div>

                                        </div>

                                    </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </form>

                            </div>
                        </div><!-- /.tab-pane -->

                    </div><!-- /.tab-content -->

                </div><!-- nav-tabs-custom -->
            </div><!-- /.col -->

        </div> <!-- /.row -->
        <!-- END CUSTOM TABS -->

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->

<script>
    //删除登陆日志
    function del(id) {
        delItem('{:U("delLoginLog")}', {id: id});
    }
    function delData(){
        doItem('{:U("delMonthLoginLog")}', {}, '确定删除一个月前的登陆日志吗?', '');
    }

    $(function(){
        //日期选择器
        var dateInput = $("input.J_date");
        if (dateInput.length) {
            dateInput.datePicker();
        }

        //日期+时间选择器
        var dateTimeInput = $("input.J_datetime");
        if (dateTimeInput.length) {
            dateTimeInput.datePicker({
                time: true
            });
        }
    });
</script>

<include file='Common:footer'/>